﻿
if (GetLocale() == "zhCN") then
	MOD_SELLER_HELPER_TITLE = {"售卖修理", "shoumaixiuli"}
	REPAIRHELPER_ENABLE_TEXT = "开启修理助手"
	REPAIRHELPER_AUTO_REPAIR_TEXT = "自动修理身上破损的装备"
	REPAIRHELPER_REPAIR_ALL_TEXT = "自动修理身上所有的的装备"
	REPAIRHELPER_USE_GUILD_MONEY_TEXT = "优先使用公会资金"
	
	SELLER_HELPER_TITLE = "售卖助手";
	SELLER_HELPER_ENABLE_TEXT = "开启售卖助手";
	SELLER_HELPER_AUTO_SELL_POOR_TEXT = "自动售卖粗糙物品";
	SELLER_HELPER_KEEP_DARKMOON_ITEM_TEXT = "不出售暗月马戏团物品";
	SELLER_HELPER_KEEP_MINING_TOOL_TEXT = "不出售暗血矿工锄";
	SELLER_HELPER_ANNOUNCE_TEXT = "显示交易统计";

	
elseif (GetLocale() == "zhTW") then
	MOD_SELLER_HELPER_TITLE = {"售賣修理", "shoumaixiuli"}
	REPAIRHELPER_ENABLE_TEXT = "開啓修理助手"
	REPAIRHELPER_AUTO_REPAIR_TEXT = "自動修理身上破損的裝備"
	REPAIRHELPER_REPAIR_ALL_TEXT = "自動修理身上所有的的裝備"
	REPAIRHELPER_USE_GUILD_MONEY_TEXT = "優先使用公會資金"
	
	SELLER_HELPER_ENABLE_TEXT = "開啟出售助手";
	SELLER_HELPER_AUTO_SELL_POOR_TEXT = "自動出售粗糙物品";
	SELLER_HELPER_KEEP_DARKMOON_ITEM_TEXT = "不出售暗月馬戲團物品";
	SELLER_HELPER_KEEP_MINING_TOOL_TEXT = "不出售暗血礦工鋤";
	SELLER_HELPER_ANNOUNCE_TEXT = "顯示交易統計";
else
	MOD_SELLER_HELPER_TITLE = "Repair and Sell"
	REPAIRHELPER_ENABLE_TEXT = "Enable Repair Helper"
	REPAIRHELPER_AUTO_REPAIR_TEXT = "Auto repair broken equipements"
	REPAIRHELPER_REPAIR_ALL_TEXT = "Repair all equipments at the same time"
	REPAIRHELPER_USE_GUILD_MONEY_TEXT = "Use guild money firstly"	
	
	SELLER_HELPER_TITLE = "Seller Helper";
	SELLER_HELPER_ENABLE_TEXT = "Enable Seller Helper";
	SELLER_HELPER_AUTO_SELL_POOR_TEXT = "Auto sell all poor items";
	SELLER_HELPER_KEEP_DARKMOON_ITEM_TEXT = "Keep Darkmoon Faire Items";
	SELLER_HELPER_KEEP_MINING_TOOL_TEXT = "Keep Mining Tool";
	SELLER_HELPER_ANNOUNCE_TEXT = "Show Trade Details";
end

	ModManagement_RegisterMod(
		"RepairAndSell",
		"Interface\\Icons\\INV_Misc_Coin_02",
		MOD_SELLER_HELPER_TITLE,
		"",
		nil,
		nil,
		{[5]=true}
	);

	ModManagement_RegisterCheckBox(
		"RepairAndSell",
		SELLER_HELPER_ENABLE_TEXT,
		nil,
		"EnableSellerHelper",
		1,
		function (__arg)
			if (__arg == 1) then
				if (not BigFoot_IsAddOnLoaded("SellerHelper")) then
					BigFoot_LoadAddOn("SellerHelper");
				end
			end
			if (BigFoot_IsAddOnLoaded("SellerHelper")) then
				SellHelper_EnableToggle(__arg);
			end
		end
	);

	ModManagement_RegisterCheckBox(
		"RepairAndSell",
		SELLER_HELPER_AUTO_SELL_POOR_TEXT,
		nil,
		"AutoSellPoor",
		1,
		function (__arg)
			if (BigFoot_IsAddOnLoaded("SellerHelper")) then
				SellHelper_SellGrayToggle(__arg);
			end
		
		end,
		1
	);

	ModManagement_RegisterCheckBox(
		"RepairAndSell",
		SELLER_HELPER_KEEP_DARKMOON_ITEM_TEXT,
		nil,
		"KeepDarkMoonItem",
		1,
		function (__arg)
			if (BigFoot_IsAddOnLoaded("SellerHelper")) then
				SellHelper_KeepDarkMoonToggle(__arg);
			end
		end,
		1
	);

	ModManagement_RegisterCheckBox(
		"RepairAndSell",
		SELLER_HELPER_KEEP_MINING_TOOL_TEXT,
		nil,
		"KeepMiningTool",
		1,
		function (__arg)
			if (BigFoot_IsAddOnLoaded("SellerHelper")) then
				SellHelper_KeepMiningToggle(__arg);
			end
		end,
		1
	);

	ModManagement_RegisterCheckBox(
		"RepairAndSell",
		SELLER_HELPER_ANNOUNCE_TEXT,
		nil,
		"ShowTradeAnnounce",
		1,
		function (__arg)
			if (BigFoot_IsAddOnLoaded("SellerHelper")) then
				SellHelper_SellAnnounceToggle(__arg)
			end
		end,
		1
	);
	
	


	
	ModManagement_RegisterCheckBox(
		"RepairAndSell",
		REPAIRHELPER_ENABLE_TEXT,
		nil,
		"EnableRepairHelper",
		1, 
		function (__arg)
			if (__arg == 1) then
				if (not BigFoot_IsAddOnLoaded("RepairHelper")) then
					BigFoot_LoadAddOn("RepairHelper");
				end
			end
			if (BigFoot_IsAddOnLoaded("RepairHelper")) then
				RepairHelper_ToggleEnable(__arg);
			end
		end
	);

	ModManagement_RegisterCheckBox(
		"RepairAndSell",
		REPAIRHELPER_AUTO_REPAIR_TEXT,	-- text
		nil,															-- tooltip
		"AutoRepairDurability",									-- variable
		1,																-- default
		function (__arg)
			if (BigFoot_IsAddOnLoaded("RepairHelper")) then
				RepairHelper_ToggleAutoRepair(__arg);
			end
		end,
		1
	);

	ModManagement_RegisterCheckBox(
		"RepairAndSell",
		REPAIRHELPER_REPAIR_ALL_TEXT,	-- text
		nil,																	-- tooltip
		"RepairHelper_RepairAll",										-- variable
		0,																		-- default
		function (__arg)														-- callback
			if (BigFoot_IsAddOnLoaded("RepairHelper")) then
				RepairHelper_ToggleRepairAll(__arg);
			end
		end,
		1
	);
				
	ModManagement_RegisterCheckBox(
		"RepairAndSell",
		REPAIRHELPER_USE_GUILD_MONEY_TEXT,
		nil,																	-- tooltip
		"RepairHelper_UseGuildMoney",
		1,																		-- default
		function (__arg)														-- callback
			if (BigFoot_IsAddOnLoaded("RepairHelper")) then
				RepairHelper_ToggleUseGuild(__arg);
			end
		end,
		2
	);